package com.roden.study.java.time;

import org.junit.Test;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.YearMonth;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.Date;

/**
 * @Author luodeng
 * @create 2021/9/17 17:47
 */
public class LocalTimeTest {
    @Test
    public void min(){
        System.out.println(DateTimeFormatter.ISO_LOCAL_TIME.format(LocalTime.MIN));
        System.out.println(LocalDate.now().with(TemporalAdjusters.firstDayOfMonth()));
        System.out.println(LocalDate.now().with(TemporalAdjusters.lastDayOfMonth()));
        System.out.println(YearMonth.now().atDay(1));
        System.out.println(YearMonth.now().atEndOfMonth());
        System.out.println(YearMonth.now().toString());

        LocalDate localDate=LocalDate.now();
        String billTime = localDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"));      

        Date dayStart = Date.from(LocalDateTime.of(localDate, LocalTime.MIN).atZone(ZoneId.systemDefault()).toInstant());
        Date dayEnd = Date.from(LocalDateTime.of(localDate, LocalTime.MAX).atZone(ZoneId.systemDefault()).toInstant());
        System.out.println(dayEnd);

        System.out.println( LocalTime.parse("23:59:59"));
        System.out.println( LocalTime.of(23,59,59));
    }
}
